<html lang="en">
<head>
    <title>待审核游记</title>
    <#include "../common/header.ftl">
    <script>
        $(function () {
            $(".changeBtn").click(function () {
                var id = $(this).data("id");
                var state = $(this).data("state");
                //发送系统消息给指定的用户,游记作者
                var authorId = $(this).data("authorid");
                $.get("/travel/changeState.do",{id:id,state:state,authorId:authorId},function (data) {
                    if(data.success){
                        $.messager.confirm("温馨提示","修改成功");
                        window.location.reload();
                    }else{
                        $.messager.confirm("温馨提示",data.msg);
                    }
                });
            });
            $(".selectContent").click(function () {
                var id = $(this).data("id");
                //获取查看的游记的信息,传送id过去
                $.get("/travel/selectByTravelId.do?travelId=" + id,function (data) {

                    $("#showModal .modal-body").html(data.travelContent.content);
                });
                $("#showModal").modal("show");
            });
        });
    </script>
    <style>
        /*设置模态框中的图片铺满*/
        #showModal img{
            width: 100%;
        }
        /*当内容大于模态框时,会自定设置滚动条*/
        #showModal .modal-body{
            max-height: 600px;
            overflow-y: auto;
        }
    </style>
</head>
<body>
<!--左侧菜单回显变量设置-->
<#assign currentMenu="travel">
<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label for="keyword">关键字:</label>
                    <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}"
                           placeholder="请输入昵称/标题">
                </div>
                <button id="btn_query" class="btn btn-info"><span class="glyphicon glyphicon-search"></span> 查询</button>
            </form>

            <table class="table table-striped table-hover" >
                <thead>
                    <tr>
                        <th>编号</th>
                        <th>标题</th>
                        <th>封面</th>
                        <th>地点</th>
                        <th>作者</th>
                        <th>状态</th>
                        <th> 操作</th>
                    </tr>
                </thead>
               <#list result.list as entity>
                   <tr>
                       <td>${entity_index + 1}</td>
                       <td>${entity.title!}</td>
                       <td><img src="${entity.coverUrl!}" width="40px"></td>
                       <td>${(entity.place.name)!}</td>
                       <td>${(entity.author.nickName)!}</td>
                       <td>${entity.stateDisplay!}</td>
                       <td>
                           <a href="javascript:void(0);" class="btn changeBtn" data-authorid="${(entity.author.id)!}" data-id="${entity.id}" data-state="3">发布</a>
                           <a href="javascript:void(0);" class="btn changeBtn" data-authorid="${(entity.author.id)!}" data-id="${entity.id}" data-state="0">拒绝</a>
                           <a href="javascript:void(0);" class="btn selectContent" data-id="${entity.id}">查看文章</a>
                       </td>
                   </tr>
               </#list>
            </table>
            <#include "../common/page.ftl">
        </div>
    </div>
</div>
<!---编辑--->
<div class="modal fade" id="showModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">查看内容</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>